#pragma once
#define JEMALLOC_MANGLE
#include <jemalloc/jemalloc.h>
//#include <xmemory>
/*
namespace occ {
    // STL allocator using jemalloc
    template <class _Ty>
    class JeAllocator {
    public:
        static_assert(!is_const_v<_Ty>, "The C++ Standard forbids containers of const elements "
            "because JeAllocator<const T> is ill-formed.");

        using _From_primary = JeAllocator;

        using value_type = _Ty;

#if _HAS_DEPRECATED_ALLOCATOR_MEMBERS
        _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS typedef _Ty* pointer;
        _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS typedef const _Ty* const_pointer;

        _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS typedef _Ty& reference;
        _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS typedef const _Ty& const_reference;
#endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS

        using size_type = size_t;
        using difference_type = ptrdiff_t;

        using propagate_on_container_move_assignment = std::true_type;

#if _HAS_DEPRECATED_ALLOCATOR_MEMBERS
        using is_always_equal _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS = std::true_type;

        template <class _Other>
        struct _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS rebind {
            using other = JeAllocator<_Other>;
        };

        _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS _NODISCARD _Ty* address(_Ty& _Val) const noexcept {
            return _STD addressof(_Val);
        }

        _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS _NODISCARD const _Ty* address(const _Ty& _Val) const noexcept {
            return _STD addressof(_Val);
        }
#endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS

        constexpr JeAllocator() noexcept {}

        constexpr JeAllocator(const JeAllocator&) noexcept = default;
        template <class _Other>
        constexpr JeAllocator(const JeAllocator<_Other>&) noexcept {}
        _CONSTEXPR20_DYNALLOC ~JeAllocator() = default;
        _CONSTEXPR20_DYNALLOC JeAllocator& operator=(const JeAllocator&) = default;

        _CONSTEXPR20_DYNALLOC void deallocate(_Ty* const _Ptr, const size_t _Count) {
            // no overflow check on the following multiply; we assume _Allocate did that check
            _Deallocate<_New_alignof<_Ty>>(_Ptr, sizeof(_Ty) * _Count);
        }

        _NODISCARD _CONSTEXPR20_DYNALLOC __declspec(JeAllocator) _Ty* allocate(_CRT_GUARDOVERFLOW const size_t _Count) {
            return static_cast<_Ty*>(je_malloc(std::_Get_size_of_n<sizeof(_Ty)>(_Count)));
        }

#if _HAS_DEPRECATED_ALLOCATOR_MEMBERS
        _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS _NODISCARD __declspec(JeAllocator) _Ty* allocate(
            _CRT_GUARDOVERFLOW const size_t _Count, const void*) {
            return allocate(_Count);
        }

        template <class _Objty, class... _Types>
        _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS void construct(_Objty* const _Ptr, _Types&&... _Args) {
            // syntax "placement new(pMyClass) MyClass(_Args)":
            // construct on existing memory without allocating new memory
            ::new (_Voidify_iter(_Ptr)) _Objty(_STD forward<_Types>(_Args)...);
        }

        template <class _Uty>
        _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS void destroy(_Uty* const _Ptr) {
            _Ptr->~_Uty();
        }

        _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS _NODISCARD size_t max_size() const noexcept {
            return static_cast<size_t>(-1) / sizeof(_Ty);
        }
#endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS
    };

    // CLASS JeAllocator<void>
    template <>
    class JeAllocator<void> {
    public:
        using value_type = void;
#if _HAS_DEPRECATED_ALLOCATOR_MEMBERS
        _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS typedef void* pointer;
        _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS typedef const void* const_pointer;
#endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS

        using size_type = size_t;
        using difference_type = ptrdiff_t;

        using propagate_on_container_move_assignment = std::true_type;

#if _HAS_DEPRECATED_ALLOCATOR_MEMBERS
        using is_always_equal _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS = std::true_type;

        template <class _Other>
        struct _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS rebind {
            using other = JeAllocator<_Other>;
        };
#endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS
    };

    template <class _Ty, class _Other>
    _NODISCARD _CONSTEXPR20_DYNALLOC bool operator==(const JeAllocator<_Ty>&, const JeAllocator<_Other>&) noexcept {
        return true;
    }

#if !_HAS_CXX20
    template <class _Ty, class _Other>
    _NODISCARD bool operator!=(const JeAllocator<_Ty>&, const JeAllocator<_Other>&) noexcept {
        return false;
    }
#endif // !_HAS_CXX20
}*/

